Learn R Programming

ks (version 1.6.13)

dnorm.mixt, rnorm.mixt: Univariate normal mixture distribution

Description

Random generation and density values from univariate normal mixture distribution.

Usage

dnorm.mixt(x, mus=0, sigmas=1, props=1)
rnorm.mixt(n=100, mus=0, sigmas=1, props=1, mixt.label=FALSE)

Arguments

n
number of random variates
x
vector of quantiles
mus
vector of means
sigmas
vector of standard deviations
props
vector of mixing proportions
mixt.label
flag to output numeric label indicating the mixture component. Default is FALSE.

Value

  • Univariate normal mixture random vectors and density values.

Examples

Run this code
x <- rnorm.mixt(1000, mus=c(-1,1), sigmas=c(0.5, 0.5), props=c(1/2, 1/2))
dens <- dnorm.mixt(x, mus=c(-1,1), sigmas=c(0.5, 0.5), props=c(1/2, 1/2))

Run the code above in your browser using DataLab